//
//  HBQsmListCell.m
//  HelloBeeQuick
//
//  Created by 李建强 on 16/8/20.
//  Copyright © 2016年 LiYiLin. All rights reserved.
//

#import "HBQsmListCell.h"
#import "HBQsmListModel.h"
@interface HBQsmListCell ()

@property (nonatomic,strong)UIView *yellowView;

@property (nonatomic,strong)UILabel *nameLabel;

@property (nonatomic,strong)UIView *lineView;

@end


@implementation HBQsmListCell


-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self setupUI];
    }
    
    return self;
}


-(UIView *)yellowView{
    
    if (_yellowView == nil) {
        _yellowView = [[UIView alloc]initWithFrame:CGRectZero];
        _yellowView.backgroundColor = KTHEMES;
    }
    return _yellowView;
}


-(UILabel *)nameLabel{
    
    if (_nameLabel == nil) {
        _nameLabel = [[UILabel alloc]initWithFrame:CGRectZero];
    }
    return _nameLabel;
}

-(UIView *)lineView{
    
    if (_lineView == nil) {
        _lineView = [[UIView alloc]initWithFrame:CGRectZero];
        _lineView.backgroundColor = [UIColor groupTableViewBackgroundColor];
        
    }
    return _lineView;
}

-(void)setModel:(HBQsmListModel *)model{
    
    _model = model;
    
    self.nameLabel.text = model.name;
}

-(void)setupUI{
    
    [self.contentView addSubview:self.yellowView];
    
    [self.contentView addSubview:self.nameLabel];
    
    [self.contentView addSubview:self.lineView];
    
    [self.yellowView mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.left.equalTo(self.contentView);
        
        make.centerY.equalTo(self.contentView);
        
        make.width.mas_equalTo(3);
        make.height.mas_equalTo(self.contentView.frame.size.height * 0.6);
    }];
    
    
    [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.centerY.equalTo(self.yellowView.mas_centerY);
        
        make.left.equalTo(self.yellowView.mas_right).offset(10);
    }];
    
    
    [self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.bottom.left.right.equalTo(self.contentView);
//        make.width.equalTo(self.contentView.mas_width);
        make.height.mas_equalTo(1);
        
    }];
}



@end





